package com.hjy.hjyojbackendjudgeservice.judge.codesandbox;


import com.hjy.hjyojbackendjudgeservice.model.codesandbox.ExeccuteCodeRequest;
import com.hjy.hjyojbackendjudgeservice.model.codesandbox.ExeccuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * 代码沙箱(代理设计模式)
 */
@Slf4j
public class CodeSandboxProxy implements CodeSandBox {
    private final CodeSandBox codeSandBox;

    public CodeSandboxProxy(CodeSandBox codeSandBox) {
        this.codeSandBox = codeSandBox;
    }

    @Override
    public ExeccuteCodeResponse execcuteCode(ExeccuteCodeRequest execcuteCodeRequest) {
        log.info("请求信息日志" + execcuteCodeRequest.toString());
        ExeccuteCodeResponse execcuteCodeResponse = codeSandBox.execcuteCode(execcuteCodeRequest);
        log.info("响应信息日志" + execcuteCodeResponse);
        return execcuteCodeResponse;
    }
}
